package com.ruoyi.apis.vo;

import com.ruoyi.apis.entity.CityEntity;
import com.ruoyi.apis.utils.ResponseUtils;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.BeanUtils;

import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author Choi
 * @Date 2021/10/15
 */

@Getter
@Setter
public class CityVO {
    private Long id;
    private String name;
    private String nameEn;
    private Integer displayCount;
    private Integer sort;
    private String bgimage;
    private Integer bgType;

    private List<DisplayVO> displays;

    public CityVO(CityEntity city) {
        BeanUtils.copyProperties(city, this);
        this.setBgimage(ResponseUtils.getFulImage(city.getBgimage()));
    }

    public static List<CityVO> getCities(List<CityEntity> cities) {
        return cities.stream()
                .map(CityVO::new)
                .collect(Collectors.toList());
    }
}
